home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok18.lha
/
IFFLib
/
ShowIFF.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
3KB
|
99 lines
(*---------------------------------------------------------------------------
:Program. ShowIFF.mod
:Author. Fridtjof Siebert
:Address. Nobileweg 67, D-7-Stgt-40
:Shortcut. [fbs]
:Version. 1.0
:Date. 25-Feb-89
:Copyright. PD
:Language. Modula-II
:Translator. M2Amiga v3.1d
:Imports. IFFLib [fbs]/Christian A. Weber
:Contents. Demonstration for IFFLib. Dispays a Picture
:Remark. You must have iff.library in your LIBS: directory.
:Remark. Original C-Version by Christian A. Weber
:Usage. ShowIFF <IFF-Pic>
---------------------------------------------------------------------------*)
MODULE ShowIFF;
FROM SYSTEM IMPORT ADDRESS, ADR;
FROM Arts IMPORT Terminate;
FROM Arguments IMPORT NumArgs, GetArg;
FROM Dos IMPORT Delay;
FROM Graphics IMPORT LoadRGB4;
FROM InOut IMPORT WriteString, WriteInt, WriteLn;
FROM Intuition IMPORT NewScreen, ScreenPtr, ScreenFlagSet, ScreenFlags,
customScreen, OpenScreen, CloseScreen;
FROM Terminal IMPORT waitCloseGadget;
FROM IFFLib IMPORT BitMapHeaderPtr, CloseIFF, OpenIFF, GetViewModes,
IffError, GetBMHD, GetColorMap, DecodePic;
VAR
ns: NewScreen;
myscreen: ScreenPtr;
ifffile: ADDRESS;
colortable: ARRAY[0..127] OF CHAR;
bmhd: BitMapHeaderPtr;
count: LONGINT;
i: INTEGER;
picname: ARRAY[0..79] OF CHAR;
Ciapra [0BFE001H]: SET OF (s0,s1,s2,s3,s4,s5,lmb);
PROCEDURE Fail(error: ARRAY OF CHAR);
BEGIN
IF ifffile #NIL THEN CloseIFF(ifffile) END;
IF myscreen#NIL THEN CloseScreen(myscreen) END;
WriteString(error); WriteLn;
WriteString("IffError: "); WriteInt(IffError(),5); WriteLn;
Terminate(0);
END Fail;
BEGIN
ifffile := NIL; waitCloseGadget := FALSE;
IF NumArgs()<1 THEN WriteString("Format: ShowIFF <FileName>") END;
GetArg(1,picname,i);
WriteString("Loading file "); WriteString(picname); WriteString(" ... ");
ifffile := OpenIFF(ADR(picname));
IF ifffile=NIL THEN Fail("Error opening file") END;
bmhd := GetBMHD(ifffile);
IF bmhd=NIL THEN Fail("BitMapHeader not found") END;
WITH ns DO
leftEdge := 0; topEdge := 0;
WITH bmhd^ DO
width := w; height := h;
depth := nPlanes;
END;
viewModes := GetViewModes(ifffile);
type := ScreenFlagSet{screenQuiet} + customScreen;
font := NIL;
defaultTitle := ADR("ShowIFF screen");
gadgets := NIL;
customBitMap := NIL;
END;
myscreen := OpenScreen(ns);
IF myscreen=NIL THEN Fail("Can't open screen!") END;
count := GetColorMap(ifffile,ADR(colortable));
IF count>32 THEN count:=32 END;
LoadRGB4(ADR(myscreen^.viewPort),ADR(colortable),count);
IF NOT DecodePic(ifffile,ADR(myscreen^.bitMap)) THEN
Fail("Can't decode the picture");
END;
i := 0;
WHILE (lmb IN Ciapra) AND (i<100) DO Delay(5); INC(i) END;
Fail("done"); (* Close the whole stuff *)
END ShowIFF.